
from astropy import units as u
from astropy.time import Time
from netorchestr.envir.base import ONet
from netorchestr.envir.node.ue import UeBase
from netorchestr.envir.mobility import Trajectory

if __name__ == '__main__':
    net = ONet("Ue")

    init_time = Time("2021-07-22 00:00:00")
    
    ue = UeBase("Ue", init_time, [113.51071, 34.755339, 0.0])
    ue_trajectory = Trajectory(name='U1Tr', avg_speed=1.5)
    ue_trajectory.add_random_in_circle(center=ue.mobiusTraj.init_gps, radius=100, anchor_number=100)
    ue.mobiusTraj.set_trajectory(ue_trajectory, init_time)
    # 停止用户的应用层定时器，仅用于演示用户运动模型轨迹
    ue.appLayer.clocktime.stop()
    net.add_module(ue)

    net.draw_flag = True
    net.draw_time_accuracy = 1*u.s
    net.draw_region = [113.51071-0.0011, 
                       113.51071+0.0011, 
                       34.755339-0.0011, 
                       34.755339+0.0011]
    net.run(until=1 * u.min)
